package com.example.qxfw.jtyb.service.impl;

import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.example.qxfw.common.entity.zy.Traffic;
import com.example.qxfw.jtyb.mapper.TrafficMapper;
import com.example.qxfw.jtyb.service.GsglybService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.Date;
import java.util.List;

@Service
public class GsglybServiceImpl implements GsglybService {

    @Autowired
    private TrafficMapper trafficMapper;


    @Override
    public List<Traffic> selectByDateTypeNtimestimecharOfTraffic(
            Date announcedtime, Integer forecasttype, Integer ntimes) {
        return trafficMapper.selectList(new LambdaQueryWrapper<Traffic>()
        .eq(announcedtime != null, Traffic::getAnnouncedtime, announcedtime)
        .eq(forecasttype != 0, Traffic::getForecasttype, forecasttype)
        .eq(ntimes != 0, Traffic::getNtimes, ntimes));
    }

    @Override
    public List<Traffic> getAllOfTraffic() {
        return trafficMapper.selectList(null);
    }
}
